package vue.panneau1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class PopupChoixLibelleVariables3D extends JPanel implements ActionListener
{
	private static final long serialVersionUID = 1L;
	private Interface3DZone1 zone3D;
	private JDialog fen;
	private JLabel labelX1,labelX2,labelX3;
	private JTextField jtfLibX1,jtfLibX2,jtfLibX3;
	private JButton bvalider;
	
	public PopupChoixLibelleVariables3D(Interface3DZone1 zone3D)
	{
		this.zone3D = zone3D;
		
		labelX1 = new JLabel("  Libellé X1 :");
		labelX2 = new JLabel("  Libellé X2 :");
		labelX3 = new JLabel("  Libellé X3 :");	
		
		jtfLibX1 = new JTextField(12);
		jtfLibX2 = new JTextField(12);
		jtfLibX3 = new JTextField(12);
		
		jtfLibX1.setText(zone3D.obtenirLibelleX1());
		jtfLibX2.setText(zone3D.obtenirLibelleX2());
		jtfLibX3.setText(zone3D.obtenirLibelleX3());
		
		bvalider = new JButton("Valider");
		bvalider.addActionListener(this);
		
		this.setLayout(new GridLayout(0,2));
		add(labelX1);
		add(jtfLibX1);
		add(labelX2);				
		add(jtfLibX2);
		add(labelX3);				
		add(jtfLibX3);
		add(new JLabel(""));
		add(bvalider);		
		
		fen = new JDialog();
		fen.add(this);
		fen.setTitle("Libellés");		
		fen.setLocationRelativeTo(zone3D);
		fen.setResizable(false);
		fen.setAlwaysOnTop(true);
		fen.pack();
		fen.setVisible(true);
	}

	public void actionPerformed(ActionEvent e) 
	{			
		zone3D.choisirLibelleX1X2X3(jtfLibX1.getText(),jtfLibX2.getText(),jtfLibX3.getText());
		fen.dispose();
	}
}

